<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
    <title></title>
    <style>
    a {
       
        font-size: 30px;
        font-weight: 900;
    } 
    
    div {
        width: 200px;
        height: 100px;
        background-color: yellow;
        color: red;
    }
    </style>
    <script src="http://libs.baidu.com/jquery/1.9.1/jquery.js"></script>
</head>

<body>
    <h2>get方法</h2>

    <div id="aaron">
        <a>1</a>
        <a>2</a>
        <a>3</a>
        <a>4</a>
        <a>5</a>
    </div>

    <select id="animation">
        <option value="1">get正数索引参数</option>
        <option value="2">get负数索引参数</option>
    </select>
    <input id="exec" type="button" value="点击执行">
    <script type="text/javascript">
    $("#exec").click(function() {
        var v = $("#animation").val();
        var $aaron = $("#aaron a");

        //通过get找到第二个a元素，并修改蓝色字体
        if (v == "1") {
           $aaron.get(1).style.color = "blue"
        } else if (v == "2") {
            //通过get找到最后一个a元素，并修改字体颜色
            $aaron.get(-1).style.color = "#8A2BE2"
        }
    });
    </script>
</body>

</html>
